export default function request(option){
	const Authorization = uni.getStorageSync("token")
	const BaseUrl=getApp().globalData.BaseUrl
	return new Promise((resolve,reject) => {
		uni.request({
			url: BaseUrl + "/" + option.url,
			method: option.method || "get",
			header:{
				Authorization,
				...option.header
			},
			params:option.params||{},
			data: option.data || {},
			success: (result) => {
				if (result.statusCode < 300) {
					resolve(result.data);
				} else {
					reject(result);
				}
			},
			fail: reject,
		})
	}).catch(() => {
		uni.showToast({
			title:'服务器出错',
			icon:"error"
		})
	})
}


